/*
 * @Description: 左侧列表
 * @Author: Zzt
 * @Date: 2022-10-12 11:17:42
 * @LastEditTime: 2022-12-21 16:27:00
 */
import UnitNav from '@/components/UnitsNav';
import { useSearchParams } from 'react-router-dom';
import { useBusinessGuidanceContext } from '../contexts/BusinessGuidanceContext';

const PageSidebar = () => {
  const { setSelectUnit } = useBusinessGuidanceContext();
  const [searchParams] = useSearchParams();

  const handleChange = (id: number, item: any) => {
    console.log(item);

    setSelectUnit(item);
  };

  return (
    <>
      <UnitNav defaultValue={parseInt(searchParams.get('unitId'), 10)} onChange={handleChange} />
    </>
  );
};

export default PageSidebar;
